# -*- coding: utf-8 -*-

import base64
from odoo import models, fields, api, _
from odoo.exceptions import UserError
from odoo.modules.module import get_module_resource

import datetime


class OldAge(models.Model):
    _name = 'old.age'
    _description = '老年人'
    _order = 'phrId'

    _inherit = ['mail.thread', 'mail.activity.mixin']

    basic_info_id = fields.Many2one('basic.info')
    phrId = fields.Char(string="档案编号", required=True)
    oldName = fields.Char("姓名", copy=False, related="basic_info_id.personName", readonly=False)
    confirm_time = fields.Date(string="确认时间", default=datetime.date.today())

    manaDoctorId = fields.Char(string="责任医生")
    createDate = fields.Date(string="建档日期", default=datetime.date.today())
    createUser = fields.Char(string="建档人员")
    org_id = fields.Char(string="管辖机构")
    create_org = fields.Char(string="建档机构")
    cancel_time = fields.Date(string="档案注销日期", default=datetime.date.today())

    @api.model
    def create(self, vals):
        res = super(OldAge, self).create(vals)
        return res
